// 需要转化的样式
const conversionPropertyArray = [
      "width",
      "height",
      "top",
      "left",
      "right",
      "bottom",
      "lineHeight",
      "fontSize",
];

const specialPropertyArray = ["backgroundImage"];

export const calculateStyle = function (formData: { [key: string]: string }) {
      const styleObj: any = { ...formData };
      for (const key in styleObj) {
            let ele = styleObj[key];
            if (conversionPropertyArray.includes(key)) {
                  styleObj[key] = isNaN(Number(styleObj[key]))
                        ? styleObj[key]
                        : styleObj[key] + "px";
            }

            if (specialPropertyArray.includes(key)) {
                  styleObj[key] = `url(${ele})`;
            }
      }
      return styleObj;
};
